package com.damon.g2048.view;

import android.content.Context;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;

public class Sound implements OnCompletionListener {

	private MediaPlayer mMp;

	public Sound(Context context, int id) {
		mMp = MediaPlayer.create(context, id);
		mMp.setOnCompletionListener(this);
	}

	public void playSound() {
		try {
			mMp.start();
		} catch (Exception e) {
		}
	}

	public void stopSound() {
		try {
			mMp.stop();
			mMp.prepare();
		} catch (Exception e) {
		}
	}

	public void stop1sSound() {
		try {
			Thread.sleep(1000);
			mMp.stop();
			mMp.prepare();
		} catch (Exception e) {
		}
	}

	@Override
	public void onCompletion(MediaPlayer mp) {
		// TODO Auto-generated method stub

	}

}
